package main

import (
	"develop_user/controller"
	"develop_user/proto/user"
	"github.com/asim/go-micro/plugins/registry/consul/v3"
	"github.com/asim/go-micro/v3"
	"github.com/asim/go-micro/v3/registry"
)

func main() {
	//consul register
	register := consul.NewRegistry(func(options *registry.Options) {
		options.Addrs = []string{"43.138.147.44:8500"}
	})

	//service register
	service := micro.NewService(
		micro.Name("develop_user"),
		micro.Version("latest"),
		micro.Registry(register), //consul
		micro.RegisterTTL(10),
		micro.RegisterInterval(1),
	)

	//service init
	service.Init()

	//RegisterUserModuleHandler
	user.RegisterUserModuleHandler(service.Server(),new(controller.User))

	//service run
	service.Run()

}
